package service

import (
	"context"

	pb "mytest0/api/mytest0/v1"
)

type Mytest0Service struct {
	pb.UnimplementedMytest0Server
}

func NewMytest0Service() *Mytest0Service {
	return &Mytest0Service{}
}

func (s *Mytest0Service) AckToClnt(ctx context.Context, req *pb.RequestFromClnt) (*pb.ReplyToClnt, error) {
	//return &pb.ReplyToClnt{}, nil

	map_req:=ParseRequestArgsToMap(req.String())

	_,S_str := ArgsAutoType(map_req["mykey"])
	_,i_str := ArgsAutoType(map_req["myvalue_i"])
	_,f_str := ArgsAutoType(map_req["myvalue_f"])

	res := &pb.ReplyToClnt{}
	//for _, v := range BackendServiceReply.Messages {
		res.Messages = append(res.Messages, &pb.Message{Content: "Hello "+ S_str +", you have "+i_str+" real numbers: "+f_str})
	//}
	return res, nil
}
